package com.easy.modules.sysmgr.web.action;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.easy.common.util.Const;
import com.easy.common.web.BaseController;
import com.easy.common.web.page.DataGrid;
import com.easy.common.web.page.Msg;
import com.easy.modules.sysmgr.service.UserRoleServiceI;
import com.easy.modules.sysmgr.web.form.UserRoleForm;

@Controller
@RequestMapping("/sysmgr/userrole")
public class UserRoleAction extends BaseController {

	@Autowired
	private UserRoleServiceI userroleService ;
	
	@RequestMapping("/userrole_main.do")
	public String userrole_main(){
		return  Const.SYSMGR + "userrole_main" ;
	}
	
	@RequestMapping("/userrole_form.do")
	public String userrole_form(UserRoleForm form, Model mode){
		if(null != form.getId() && !"".equals(form.getId())) {
			mode.addAttribute("id", form.getId()) ;
		}
		return Const.SYSMGR + "userrole_form" ;
	}
	
	@RequestMapping("/get.do")
	@ResponseBody
	public UserRoleForm get(UserRoleForm form){
		return this.userroleService.get(form) ;
	}
	
	@RequestMapping("/add.do")
	@ResponseBody
	synchronized public Msg add(UserRoleForm form){
		return this.userroleService.save(form) ;
	}
	
	@RequestMapping("/edit.do")
	@ResponseBody
	public Msg edit(UserRoleForm form){
		return this.userroleService.edit(form) ;
	}
	
	@RequestMapping("/delete.do")
	@ResponseBody
	public Msg delete(UserRoleForm form){
		return this.userroleService.delete(form) ;
	}
	
	@RequestMapping("/datagrid.do")
	@ResponseBody
	public DataGrid datagrid(UserRoleForm form){
		return this.userroleService.datagrid(form) ;
	}
	
	@RequestMapping("/doNotNeedAuth_datagrid.do")
	@ResponseBody
	public DataGrid doNotNeedAuth_datagrid(UserRoleForm form){
		return this.userroleService.datagrid(form) ;
	}
}
